<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function findColnumTypeCurrency(obj) {  
    const results = [];  

    function traverse(obj, parentKey,parentIndex) {  
        for (const key in obj) {  
            if (obj.hasOwnProperty(key)) {  
                const value = obj[key];  
                const currentPath = parentKey ? parentKey : key;  
                let index1=-1;
                // 如果当前值是对象或数组，递归遍历  
                if (typeof value === 'object' && value !== null) {  
                    if (Array.isArray(value)) {  
                        value.forEach((item, index) => {  
                          index1=index;  
                          traverse(item, currentPath);  
                        });  
                    } else {  
                        traverse(value, currentPath);  
                    }  
                }  
  
                // 检查当前对象是否包含colnumtype键，并且其值为currency  
                if (key.includes('colnumtype') && value === 'currency') {  
                    results.push({  
                        parentKey: parentKey,  
                        key: key,  
                        value: value,
                        index:index1
                    });  
                }  
            }  
        }  
    }  
  
    traverse(obj);  
    return results;  
}  
  
// 示例对象  
const data = {  
    "temp": "ae45a382-f0cf-11ee-9910-5350bbe6b16d",  
    "series": {  
        "value": [  
            {  
                "label-normal-colnumtype": "currency",  
                "label-normal-showw": "固定除千"  
            },  
            {  
              "label-normal-colnumtype": "currency",    
                "label-normal-showw": "货币格式"  
            }  
        ]  
    }  
};  
const data1={
    "columns": {
        "value": [
            {
                "attrName": "goodsclassname",
                "format-colnumtype": "currency"
            },
            {
                "attrName": "totalmoney",
                "format-colnumtype": "routine"
            },
            {
                "attrName": "price",
                "format-colnumtype": "routine"
            }
        ],
        "select": 1
    }
}
  
// 调用函数并打印结果  
const found = findColnumTypeCurrency(data1);  
console.log(found);
    </script>
  </body>
</html>
